import hibernate.method.AdditionalMethods;
import hibernate.model.Game;
import hibernate.util.HibernateUtil;

import org.hibernate.Session;
import org.hibernate.SessionFactory;


public class Test {

	public static void main(String[] args) {
SessionFactory sessionFactory = HibernateUtil.getSessionAnnotationFactory();
		//Session session = HibernateUtil.getSessionFactory().openSession();
Session session= sessionFactory.openSession();
session.beginTransaction();

Game g = new Game();
g.setAdded(AdditionalMethods.getCurrentDate());
g.setDescribe("opis");
g.setName("nazwa");
g.setUsers_max(Integer.parseInt("1"));
g.setUsers_min(Integer.parseInt("2"));
session.save(g);


//EventMethods em = new EventMethods();
//RateMethods rm = new RateMethods();
//System.out.println(rm.returnAverageRateByGame(sessionFactory, session, 7));
//List<EventParticipating> eplist = em.listParticipatingByUser(sessionFactory, session, 2);

//for (EventParticipating e : eplist){
//	System.out.println(e.getEvent_id());
//	UserEvent ue = em.findUserEventById(sessionFactory, session, e.getEvent_id()).get(0);
//	System.out.println(ue.getEventname());
	
//}


//Criteria cr = session.createCriteria(Assortment.class);
//cr.add(Restrictions.eq("local_id", 9));
//List<Assortment> lista = new ArrayList<Assortment>();
//lista = cr.list();
//for (Assortment a : lista){
//	System.out.println(a.getItems());
//}
//Criteria cr = session.createCriteria(Event.class);
//cr.add(Restrictions.eq("local", String.valueOf(9)));
//List<Event> ev = new ArrayList<Event>();
//ev= cr.list();
//for (Event e1:ev){
//	System.out.println(e1.getLocal());
//}

session.getTransaction().commit();
	}

}
